function Wavefront(filename)
{	
	this.images = null;	
	this.filename = filename;
}

Wavefront.prototype.load = function()
{
	getDoc(this.filename, Wavefront.load, this);
}

Wavefront.prototype.draw = function()
{
	{
		gl.activeTexture(gl.TEXTURE0);
		gl.uniform1i(gl.getUniformLocation(shaderProgram, "imgdata"), 0);

		gl.bindBuffer(gl.ARRAY_BUFFER, this.glBuffers.uv);
		gl.vertexAttribPointer(aTextureLocation, 2, gl.FLOAT, false, 0, 0);

		gl.bindBuffer(gl.ARRAY_BUFFER, this.glBuffers.vertices);
		gl.vertexAttribPointer(aLocation, 3, gl.FLOAT, false, 0, 0);
	}

	gl.bindTexture(gl.TEXTURE_2D, this.texture);
	gl.drawArrays(gl.TRIANGLES, 0, this.nvertices);

	gl.finish();
}

Wavefront.prototype.setTextures = function(images){

	//... Provisoirement pour une seul texture,
	//la premiere du stack
	this.texture = gl.createTexture();//textures[0]

	gl.bindTexture(gl.TEXTURE_2D, this.texture);
	gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
	gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[0]);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
	gl.generateMipmap(gl.TEXTURE_2D);
	gl.bindTexture(gl.TEXTURE_2D, null);
}

Wavefront.load = function(xhr)
{

	var objLoader = new WavefrontLoader(xhr);
	xhr.ref.glBuffers = objLoader.initBuffers();
	xhr.ref.nvertices = objLoader.nvertices;

	objLoader = null;

	Wavefront.nfile -= 1;
	if(Wavefront.nfile == 0)
	{
		Wavefront.allLoaded();
	}
}
